// 单例模式 Storage 存储
class Storage {
  static getInstance() {
    if (!Storage.instance) {
      Storage.instance = new Storage();
    }
    return Storage.instance;
  }

  set(key, value) {
    localStorage.set(key, JSON.stringify(value));
  }

  get(key) {
    const D = localStorage.getItem(key);
    return D ? JSON.parse(D) : null;
  }

  remove(key) {
    localStorage.removeItem(key);
  }
}
